<?php
/**
 * Main configuration.
 * All properties can be overridden in mode_<mode>.php files
 */
return array(
	'yiiSetPathOfAlias'=>array(
	),
	'configWeb'=>array(
		'basePath'=>dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',
		'name'=>'Simple HRIS',
		'preload'=>array(
			'log',
			'less',
			'kint',
			'user', // Preload user or Right Modules crash sometimes @_@
		),
		'theme'=>'classic',
		'defaultController'=>'qa',
		'homeUrl'=>array('/qa/question/index'),
		'import'=>array(
			'application.models.*',
			'application.components.*',
			'application.extensions.*',
			'application.behaviors.*',
			'ext.restfullyii.components.*',
			'application.modules.user.models.*',
			'application.modules.user.components.*',
			'application.modules.rights.*',
			'application.modules.rights.components.*',
			'ext.Kint.Kint',
		),
		'behaviors'=>array(
			'application.behaviors.ApplicationBehavior',
			'layout'=>'application.behaviors.LayoutBehavior',
		),
		'components'=>array(
			'format'=>array(
				'dateFormat'=>'l, F j, Y',
				'datetimeFormat'=>'l, F j, Y h:m A',
			// Or you can define everywhere in the view:
			// Yii::app()->formatter->dateFormat = 'l, F j, Y';
			),
			'user'=>array(
				'class'=>'WebUser',
				'allowAutoLogin'=>true,
				'loginUrl'=>array('/user/login'),
			),
			'authManager'=>array(
				'class'=>'RDbAuthManager',
				'connectionID'=>'db',
				'itemTable'=>'auths',
				'itemChildTable'=>'auths_childs',
				'assignmentTable'=>'auths_assignments',
			),
			'clientScript'=>array(
				'class'=>'ClientScript',
			),
			'less'=>array(
				'class'=>'Less',
				'touchPaths'=>array(
					'assets',
					'modules/qa/assets',
				),
				'paths'=>array(
					"assets/less/typography.less"=>"assets/css/typography.css",
					"assets/less/form.less"=>"assets/css/form.css",
					"assets/classic/less/main.less"=>
					"assets/classic/css/main.css",
					"assets/angrybirds/less/main.less"=>
					"assets/angrybirds/css/main.css",
					"modules/qa/assets/less/typography.less"=>
					"modules/qa/assets/css/typography.css",
				),
			),
			'kint'=>array(
				'class'=>'ext.Kint.Kint',
			),
			'email'=>array(
				'class'=>'ext.KEmail.KEmail',
				'host_name'=>'smtp.gmail.com',
				'host_port'=>465,
				'ssl'=>true,
				'timeout'=>30,
				'user'=>'ai.yori.aoshi.2012@gmail.com',
				'password'=>'AiYoriAoshi',
				'authentication_mechanism'=>'LOGIN',
			),
			'urlManager'=>array(
				'urlFormat'=>'path',
				'showScriptName'=>false,
				'urlSuffix'=>'.html',
				'rules'=>array(
					'api/<controller:\w+>'=>array(
						'<controller>/restList',
						'verb'=>'GET'
					),
					'api/<controller:\w+>/<id:\w+>'=>array(
						'<controller>/restView',
						'verb'=>'GET'
					),
					'api/<controller:\w+>/<id:\w+>/<var:\w+>'=>array(
						'<controller>/restView',
						'verb'=>'GET'
					),
					array(
						'<controller>/restUpdate',
						'pattern'=>'api/<controller:\w+>/<id:\d+>',
						'verb'=>'PUT'
					),
					array(
						'<controller>/restDelete',
						'pattern'=>'api/<controller:\w+>/<id:\d+>',
						'verb'=>'DELETE'
					),
					array(
						'<controller>/restCreate',
						'pattern'=>'api/<controller:\w+>',
						'verb'=>'POST'
					),
					array(
						'<controller>/restCreate',
						'pattern'=>'api/<controller:\w+>/<id:\w+>',
						'verb'=>'POST'
					),
					'<controller:\w+>/<id:\d+>'=>'<controller>/view',
					'<controller:\w+>/<action:\w+>/<id:\d+>'=>
					'<controller>/<action>',
					'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
				),
			),
			'errorHandler'=>array(
				'errorAction'=>'site/error',
			),
		),
	),
	'configConsole'=>array(
		'basePath'=>dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',
		'name'=>'Miyabi',
		'preload'=>array('log'),
		'import'=>'inherit',
		'components'=>array(
			'db'=>'inherit',
			'authManager'=>'inherit',
			'log'=>array(
				'class'=>'CLogRouter',
				'routes'=>array(
					array(
						'class'=>'CFileLogRoute',
						'levels'=>'error, warning, trace, info',
					),
				),
			),
			'email'=>'inherit',
		),
		'commandMap'=>array(
			'migrate'=>array(
				'class'=>'ext.yiiext.commands.migrate.EMigrateCommand',
				'migrationPath'=>'application.migrations',
				'migrationTable'=>'migrations',
				'applicationModuleName'=>'core',
				'modulePaths'=>array(
					'user'=>'application.modules.user.migrations',
					'qa'=>'application.modules.qa.migrations',
//					'comment'=>'application.modules.comment.migrations',
				),
//				'migrationSubPath'=>'migrations',
				'disabledModules'=>array(
//					'user',
				),
				'connectionID'=>'db',
			),
		),
	),
);